
import java.sql.Connection;
import java.sql.Date;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Bruno
 */
public class Prototipo extends javax.swing.JFrame {
    String passcode = "1q2w3e";
    /**
     * Creates new form Efetuar
     */
    public Prototipo() {
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        TituloPrograma = new javax.swing.JLabel();
        PanelCadastros = new javax.swing.JTabbedPane();
        PanelCadastroFuncionario = new javax.swing.JPanel();
        jLabel15 = new javax.swing.JLabel();
        jLabel16 = new javax.swing.JLabel();
        jLabel17 = new javax.swing.JLabel();
        jLabel19 = new javax.swing.JLabel();
        jLabel20 = new javax.swing.JLabel();
        jLabel21 = new javax.swing.JLabel();
        ButtonCadastrarFuncionario = new javax.swing.JButton();
        TextFieldFuncionarioLogradouro = new javax.swing.JTextField();
        TextFieldFuncionarioNumero = new javax.swing.JTextField();
        TextFieldFuncionarioCEP = new javax.swing.JTextField();
        TextFieldFuncionarioEstado = new javax.swing.JTextField();
        jLabel11 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        TextFieldFuncionarioCidade = new javax.swing.JTextField();
        jLabel18 = new javax.swing.JLabel();
        jLabel35 = new javax.swing.JLabel();
        TextFieldFuncionarioComplemento = new javax.swing.JTextField();
        jLabel36 = new javax.swing.JLabel();
        jLabel37 = new javax.swing.JLabel();
        TextFieldFuncionarioCPF = new javax.swing.JTextField();
        TextFieldFuncionarioNome = new javax.swing.JTextField();
        TextFieldFuncionarioDataDeNasc = new javax.swing.JTextField();
        TextFieldFuncionarioSalario = new javax.swing.JTextField();
        TextFieldFuncionarioEmail = new javax.swing.JTextField();
        TextFieldFuncionarioTelefone = new javax.swing.JTextField();
        PanelCadastroCliente = new javax.swing.JPanel();
        jLabel28 = new javax.swing.JLabel();
        jLabel29 = new javax.swing.JLabel();
        jLabel30 = new javax.swing.JLabel();
        jLabel31 = new javax.swing.JLabel();
        jLabel32 = new javax.swing.JLabel();
        jLabel33 = new javax.swing.JLabel();
        jLabel34 = new javax.swing.JLabel();
        ButtonCadastrarCliente = new javax.swing.JButton();
        jLabel38 = new javax.swing.JLabel();
        jLabel39 = new javax.swing.JLabel();
        jLabel40 = new javax.swing.JLabel();
        jLabel41 = new javax.swing.JLabel();
        jLabel42 = new javax.swing.JLabel();
        jLabel43 = new javax.swing.JLabel();
        jLabel44 = new javax.swing.JLabel();
        jLabel45 = new javax.swing.JLabel();
        TextFieldClienteLogradouro = new javax.swing.JTextField();
        TextFieldClienteNumero = new javax.swing.JTextField();
        TextFieldClienteCEP = new javax.swing.JTextField();
        TextFieldClienteEstado = new javax.swing.JTextField();
        TextFieldClienteCidade = new javax.swing.JTextField();
        TextFieldClienteComplemento = new javax.swing.JTextField();
        TextFieldClienteCPF = new javax.swing.JTextField();
        TextFieldClienteNome = new javax.swing.JTextField();
        TextFieldClienteDataDeNasc = new javax.swing.JTextField();
        TextFieldClienteEndereco = new javax.swing.JTextField();
        TextFieldClienteEmail = new javax.swing.JTextField();
        TextFieldClienteTelefone = new javax.swing.JTextField();
        TextFieldClienteRenda = new javax.swing.JTextField();
        TextFieldProdutoID = new javax.swing.JPanel();
        jLabel22 = new javax.swing.JLabel();
        jLabel24 = new javax.swing.JLabel();
        jLabel25 = new javax.swing.JLabel();
        jLabel26 = new javax.swing.JLabel();
        jLabel27 = new javax.swing.JLabel();
        TextFieldProdutoCodigo = new javax.swing.JTextField();
        TextFieldProdutoMarca = new javax.swing.JTextField();
        TextFieldProdutoModelo = new javax.swing.JTextField();
        TextFieldProdutoPreco = new javax.swing.JTextField();
        TextFieldProdutoNumSerie = new javax.swing.JTextField();
        ButtonCadastrarProduto = new javax.swing.JButton();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        PanelTroca = new javax.swing.JPanel();
        jLabel5 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jButton2 = new javax.swing.JButton();
        TextFieldCodigoNovoProduto = new javax.swing.JTextField();
        TextFieldCodigoDefeituoso = new javax.swing.JTextField();
        PanelVenda = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        ButtonEfetuarVenda = new javax.swing.JButton();
        jLabel9 = new javax.swing.JLabel();
        jButton3 = new javax.swing.JButton();
        ComboBoxEfetuarVendaItensCarrinho = new javax.swing.JComboBox();
        jLabel3 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        TextFieldVendaID = new javax.swing.JTextField();
        TextFieldVendaCodigoDoProduto = new javax.swing.JTextField();
        TextFieldVendaClienteCPF = new javax.swing.JTextField();
        TextFieldVendaFuncionarioCPF = new javax.swing.JTextField();
        TextFieldDataDeVenda = new javax.swing.JTextField();
        TextFieldDataDeGarantia = new javax.swing.JTextField();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Sistema de Venda de Eletrodomésticos");
        setBackground(new java.awt.Color(153, 255, 102));
        setBounds(new java.awt.Rectangle(0, 0, 0, 0));

        TituloPrograma.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        TituloPrograma.setText("Trabalho de PCS-SGBD (Eletrodomésticos)");

        jLabel15.setText("CPF");

        jLabel16.setText("Nome");

        jLabel17.setText("Data de Nascimento");

        jLabel19.setText("E-mail");

        jLabel20.setText("Telefone");

        jLabel21.setText("Salário");

        ButtonCadastrarFuncionario.setText("Cadastrar");
        ButtonCadastrarFuncionario.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ButtonCadastrarFuncionarioActionPerformed(evt);
            }
        });

        TextFieldFuncionarioLogradouro.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                TextFieldFuncionarioLogradouroActionPerformed(evt);
            }
        });

        jLabel11.setText("Logradouro");

        jLabel12.setText("Número");

        jLabel13.setText("CEP");

        jLabel14.setText("Estado");

        jLabel18.setText("Cidade");

        jLabel35.setText("Complemento");

        jLabel36.setText("Formulário:");

        jLabel37.setText("Endereço:");

        javax.swing.GroupLayout PanelCadastroFuncionarioLayout = new javax.swing.GroupLayout(PanelCadastroFuncionario);
        PanelCadastroFuncionario.setLayout(PanelCadastroFuncionarioLayout);
        PanelCadastroFuncionarioLayout.setHorizontalGroup(
            PanelCadastroFuncionarioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PanelCadastroFuncionarioLayout.createSequentialGroup()
                .addGap(108, 108, 108)
                .addComponent(jLabel36)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jLabel37)
                .addGap(130, 130, 130))
            .addGroup(PanelCadastroFuncionarioLayout.createSequentialGroup()
                .addGap(18, 18, 18)
                .addGroup(PanelCadastroFuncionarioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel16)
                    .addComponent(jLabel15)
                    .addComponent(jLabel21)
                    .addComponent(jLabel17)
                    .addGroup(PanelCadastroFuncionarioLayout.createSequentialGroup()
                        .addGroup(PanelCadastroFuncionarioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel19)
                            .addComponent(jLabel20))
                        .addGap(79, 79, 79)
                        .addGroup(PanelCadastroFuncionarioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(TextFieldFuncionarioSalario)
                            .addComponent(TextFieldFuncionarioCPF, javax.swing.GroupLayout.DEFAULT_SIZE, 74, Short.MAX_VALUE)
                            .addComponent(TextFieldFuncionarioNome)
                            .addComponent(TextFieldFuncionarioDataDeNasc)
                            .addComponent(TextFieldFuncionarioEmail)
                            .addComponent(TextFieldFuncionarioTelefone))))
                .addGap(90, 90, 90)
                .addGroup(PanelCadastroFuncionarioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel11)
                    .addComponent(jLabel12)
                    .addComponent(jLabel13)
                    .addComponent(jLabel14)
                    .addComponent(jLabel18)
                    .addComponent(jLabel35))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 67, Short.MAX_VALUE)
                .addGroup(PanelCadastroFuncionarioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(TextFieldFuncionarioComplemento)
                    .addComponent(TextFieldFuncionarioCidade)
                    .addComponent(TextFieldFuncionarioEstado)
                    .addComponent(TextFieldFuncionarioCEP)
                    .addComponent(TextFieldFuncionarioNumero)
                    .addComponent(TextFieldFuncionarioLogradouro, javax.swing.GroupLayout.PREFERRED_SIZE, 117, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
            .addGroup(PanelCadastroFuncionarioLayout.createSequentialGroup()
                .addGap(217, 217, 217)
                .addComponent(ButtonCadastrarFuncionario, javax.swing.GroupLayout.PREFERRED_SIZE, 122, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        PanelCadastroFuncionarioLayout.setVerticalGroup(
            PanelCadastroFuncionarioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PanelCadastroFuncionarioLayout.createSequentialGroup()
                .addGroup(PanelCadastroFuncionarioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(PanelCadastroFuncionarioLayout.createSequentialGroup()
                        .addGap(29, 29, 29)
                        .addComponent(jLabel37))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, PanelCadastroFuncionarioLayout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel36)))
                .addGroup(PanelCadastroFuncionarioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(PanelCadastroFuncionarioLayout.createSequentialGroup()
                        .addGap(3, 3, 3)
                        .addGroup(PanelCadastroFuncionarioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel15)
                            .addComponent(TextFieldFuncionarioCPF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(PanelCadastroFuncionarioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel16)
                            .addComponent(TextFieldFuncionarioNome, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(PanelCadastroFuncionarioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel17)
                            .addComponent(TextFieldFuncionarioDataDeNasc, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(PanelCadastroFuncionarioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel21)
                            .addComponent(TextFieldFuncionarioSalario, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(21, 21, 21)
                        .addGroup(PanelCadastroFuncionarioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel19)
                            .addComponent(TextFieldFuncionarioEmail, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(22, 22, 22)
                        .addGroup(PanelCadastroFuncionarioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel20)
                            .addComponent(TextFieldFuncionarioTelefone, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(PanelCadastroFuncionarioLayout.createSequentialGroup()
                        .addGroup(PanelCadastroFuncionarioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(TextFieldFuncionarioLogradouro, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel11))
                        .addGap(18, 18, 18)
                        .addGroup(PanelCadastroFuncionarioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(TextFieldFuncionarioNumero, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel12))
                        .addGap(18, 18, 18)
                        .addGroup(PanelCadastroFuncionarioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel13)
                            .addComponent(TextFieldFuncionarioCEP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(PanelCadastroFuncionarioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel14)
                            .addComponent(TextFieldFuncionarioEstado, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(PanelCadastroFuncionarioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(PanelCadastroFuncionarioLayout.createSequentialGroup()
                                .addGap(22, 22, 22)
                                .addComponent(jLabel18)
                                .addGap(18, 18, 18)
                                .addComponent(jLabel35))
                            .addGroup(PanelCadastroFuncionarioLayout.createSequentialGroup()
                                .addGap(18, 18, 18)
                                .addComponent(TextFieldFuncionarioCidade, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(TextFieldFuncionarioComplemento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 113, Short.MAX_VALUE)
                .addComponent(ButtonCadastrarFuncionario, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(43, 43, 43))
        );

        PanelCadastros.addTab("Cadastrar Funcionario", PanelCadastroFuncionario);

        jLabel28.setText("CPF");

        jLabel29.setText("Nome");

        jLabel30.setText("Data de Nascimento");

        jLabel31.setText("Endereço");

        jLabel32.setText("E-mail");

        jLabel33.setText("Telefone");

        jLabel34.setText("Renda Mensal");

        ButtonCadastrarCliente.setText("Cadastrar");
        ButtonCadastrarCliente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ButtonCadastrarClienteActionPerformed(evt);
            }
        });

        jLabel38.setText("Numero");

        jLabel39.setText("Logradouro");

        jLabel40.setText("CEP");

        jLabel41.setText("estado");

        jLabel42.setText("Cidade");

        jLabel43.setText("Complemento");

        jLabel44.setText("Formulario:");

        jLabel45.setText("Endereço:");

        javax.swing.GroupLayout PanelCadastroClienteLayout = new javax.swing.GroupLayout(PanelCadastroCliente);
        PanelCadastroCliente.setLayout(PanelCadastroClienteLayout);
        PanelCadastroClienteLayout.setHorizontalGroup(
            PanelCadastroClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PanelCadastroClienteLayout.createSequentialGroup()
                .addGroup(PanelCadastroClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(PanelCadastroClienteLayout.createSequentialGroup()
                        .addGap(27, 27, 27)
                        .addGroup(PanelCadastroClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel28)
                            .addComponent(jLabel29)
                            .addComponent(jLabel30)
                            .addComponent(jLabel31)
                            .addComponent(jLabel32)
                            .addComponent(jLabel33)
                            .addComponent(jLabel34))
                        .addGap(27, 27, 27)
                        .addGroup(PanelCadastroClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(TextFieldClienteNome)
                            .addComponent(TextFieldClienteCPF)
                            .addComponent(TextFieldClienteDataDeNasc)
                            .addComponent(TextFieldClienteEndereco)
                            .addComponent(TextFieldClienteEmail)
                            .addComponent(TextFieldClienteTelefone)
                            .addComponent(TextFieldClienteRenda, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 110, Short.MAX_VALUE))
                        .addGap(62, 62, 62)
                        .addGroup(PanelCadastroClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel39)
                            .addComponent(jLabel38)
                            .addComponent(jLabel40)
                            .addComponent(jLabel41)
                            .addComponent(jLabel42)
                            .addComponent(jLabel43))
                        .addGap(35, 35, 35)
                        .addGroup(PanelCadastroClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(TextFieldClienteLogradouro)
                            .addComponent(TextFieldClienteComplemento, javax.swing.GroupLayout.DEFAULT_SIZE, 94, Short.MAX_VALUE)
                            .addComponent(TextFieldClienteCidade)
                            .addComponent(TextFieldClienteEstado)
                            .addComponent(TextFieldClienteCEP)
                            .addComponent(TextFieldClienteNumero)))
                    .addGroup(PanelCadastroClienteLayout.createSequentialGroup()
                        .addGap(224, 224, 224)
                        .addComponent(ButtonCadastrarCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 122, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addGroup(PanelCadastroClienteLayout.createSequentialGroup()
                .addGap(113, 113, 113)
                .addComponent(jLabel44)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 202, Short.MAX_VALUE)
                .addComponent(jLabel45)
                .addGap(144, 144, 144))
        );
        PanelCadastroClienteLayout.setVerticalGroup(
            PanelCadastroClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PanelCadastroClienteLayout.createSequentialGroup()
                .addGap(13, 13, 13)
                .addGroup(PanelCadastroClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel44)
                    .addComponent(jLabel45))
                .addGap(18, 18, 18)
                .addGroup(PanelCadastroClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel28)
                    .addComponent(jLabel39)
                    .addComponent(TextFieldClienteLogradouro, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(TextFieldClienteCPF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(PanelCadastroClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel29)
                    .addComponent(jLabel38)
                    .addComponent(TextFieldClienteNumero, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(TextFieldClienteNome, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(PanelCadastroClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel30)
                    .addComponent(jLabel40)
                    .addComponent(TextFieldClienteCEP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(TextFieldClienteDataDeNasc, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(PanelCadastroClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel31)
                    .addComponent(jLabel41)
                    .addComponent(TextFieldClienteEstado, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(TextFieldClienteEndereco, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(PanelCadastroClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel32)
                    .addComponent(jLabel42)
                    .addComponent(TextFieldClienteCidade, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(TextFieldClienteEmail, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(21, 21, 21)
                .addGroup(PanelCadastroClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel33)
                    .addComponent(jLabel43)
                    .addComponent(TextFieldClienteComplemento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(TextFieldClienteTelefone, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(PanelCadastroClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel34)
                    .addComponent(TextFieldClienteRenda, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addComponent(ButtonCadastrarCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(105, Short.MAX_VALUE))
        );

        PanelCadastros.addTab("Cadastrar Cliente", PanelCadastroCliente);

        jLabel22.setText("idProduto");

        jLabel24.setText("Marca");

        jLabel25.setText("Modelo");

        jLabel26.setText("Preço");

        jLabel27.setText("Numero de Série");

        ButtonCadastrarProduto.setText("Cadastrar");
        ButtonCadastrarProduto.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ButtonCadastrarProdutoActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout TextFieldProdutoIDLayout = new javax.swing.GroupLayout(TextFieldProdutoID);
        TextFieldProdutoID.setLayout(TextFieldProdutoIDLayout);
        TextFieldProdutoIDLayout.setHorizontalGroup(
            TextFieldProdutoIDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(TextFieldProdutoIDLayout.createSequentialGroup()
                .addGap(115, 115, 115)
                .addGroup(TextFieldProdutoIDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, TextFieldProdutoIDLayout.createSequentialGroup()
                        .addComponent(jLabel25)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(TextFieldProdutoModelo, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, TextFieldProdutoIDLayout.createSequentialGroup()
                        .addComponent(jLabel26)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(TextFieldProdutoPreco, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, TextFieldProdutoIDLayout.createSequentialGroup()
                        .addComponent(jLabel27)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 113, Short.MAX_VALUE)
                        .addComponent(TextFieldProdutoNumSerie, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, TextFieldProdutoIDLayout.createSequentialGroup()
                        .addComponent(jLabel24)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(TextFieldProdutoMarca, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, TextFieldProdutoIDLayout.createSequentialGroup()
                        .addComponent(jLabel22)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(TextFieldProdutoCodigo, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(131, Short.MAX_VALUE))
            .addGroup(TextFieldProdutoIDLayout.createSequentialGroup()
                .addGap(189, 189, 189)
                .addComponent(ButtonCadastrarProduto, javax.swing.GroupLayout.PREFERRED_SIZE, 122, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        TextFieldProdutoIDLayout.setVerticalGroup(
            TextFieldProdutoIDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(TextFieldProdutoIDLayout.createSequentialGroup()
                .addGap(63, 63, 63)
                .addGroup(TextFieldProdutoIDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel22)
                    .addComponent(TextFieldProdutoCodigo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(TextFieldProdutoIDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel24)
                    .addComponent(TextFieldProdutoMarca, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(24, 24, 24)
                .addGroup(TextFieldProdutoIDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel25)
                    .addComponent(TextFieldProdutoModelo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(TextFieldProdutoIDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel26)
                    .addComponent(TextFieldProdutoPreco, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(TextFieldProdutoIDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel27)
                    .addComponent(TextFieldProdutoNumSerie, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(37, 37, 37)
                .addComponent(ButtonCadastrarProduto, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(142, Short.MAX_VALUE))
        );

        PanelCadastros.addTab("Cadastrar Produto", TextFieldProdutoID);

        jLabel5.setText("Código do Produto Defeituoso");

        jLabel8.setText("Código do Novo Produto");

        jButton2.setText("Finalizar Troca");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout PanelTrocaLayout = new javax.swing.GroupLayout(PanelTroca);
        PanelTroca.setLayout(PanelTrocaLayout);
        PanelTrocaLayout.setHorizontalGroup(
            PanelTrocaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PanelTrocaLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(PanelTrocaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(PanelTrocaLayout.createSequentialGroup()
                        .addGap(182, 182, 182)
                        .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(PanelTrocaLayout.createSequentialGroup()
                        .addGroup(PanelTrocaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel8)
                            .addComponent(jLabel5))
                        .addGap(38, 38, 38)
                        .addGroup(PanelTrocaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(TextFieldCodigoDefeituoso, javax.swing.GroupLayout.PREFERRED_SIZE, 133, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(TextFieldCodigoNovoProduto, javax.swing.GroupLayout.PREFERRED_SIZE, 133, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap(232, Short.MAX_VALUE))
        );
        PanelTrocaLayout.setVerticalGroup(
            PanelTrocaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PanelTrocaLayout.createSequentialGroup()
                .addGroup(PanelTrocaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(PanelTrocaLayout.createSequentialGroup()
                        .addGap(42, 119, Short.MAX_VALUE)
                        .addGroup(PanelTrocaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(TextFieldCodigoDefeituoso, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel5))
                        .addGap(61, 61, 61)
                        .addComponent(TextFieldCodigoNovoProduto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(PanelTrocaLayout.createSequentialGroup()
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jLabel8)))
                .addGap(107, 107, 107)
                .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 54, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(44, 44, 44))
        );

        jTabbedPane1.addTab("Efetuar Troca", PanelTroca);

        jLabel1.setText("ID Venda");

        jLabel2.setText("Cliente CPF");

        jLabel4.setText("Funcionario CPF");

        jLabel6.setText("Data de Garantia");

        ButtonEfetuarVenda.setText("Finalizar");
        ButtonEfetuarVenda.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ButtonEfetuarVendaActionPerformed(evt);
            }
        });

        jLabel9.setText("Código do Produto");

        jButton3.setText("Acrescentar ao Carrinho");

        ComboBoxEfetuarVendaItensCarrinho.setModel(new javax.swing.DefaultComboBoxModel(
            //new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }
            new String[] { }
        ));

        jLabel3.setText("Itens no carrinho");

        jLabel7.setText("Data de Venda");

        javax.swing.GroupLayout PanelVendaLayout = new javax.swing.GroupLayout(PanelVenda);
        PanelVenda.setLayout(PanelVendaLayout);
        PanelVendaLayout.setHorizontalGroup(
            PanelVendaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PanelVendaLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(PanelVendaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel3)
                    .addComponent(jLabel6)
                    .addComponent(jLabel4)
                    .addComponent(jLabel1)
                    .addComponent(jLabel9)
                    .addComponent(jLabel2)
                    .addComponent(jLabel7))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(PanelVendaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jButton3, javax.swing.GroupLayout.DEFAULT_SIZE, 159, Short.MAX_VALUE)
                    .addComponent(ComboBoxEfetuarVendaItensCarrinho, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(TextFieldVendaID)
                    .addComponent(TextFieldVendaCodigoDoProduto)
                    .addComponent(TextFieldVendaClienteCPF)
                    .addComponent(TextFieldVendaFuncionarioCPF)
                    .addComponent(TextFieldDataDeVenda)
                    .addComponent(TextFieldDataDeGarantia))
                .addContainerGap())
            .addGroup(PanelVendaLayout.createSequentialGroup()
                .addGap(200, 200, 200)
                .addComponent(ButtonEfetuarVenda, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(259, Short.MAX_VALUE))
        );
        PanelVendaLayout.setVerticalGroup(
            PanelVendaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PanelVendaLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(PanelVendaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(TextFieldVendaID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(PanelVendaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel9)
                    .addComponent(TextFieldVendaCodigoDoProduto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 101, Short.MAX_VALUE)
                .addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(PanelVendaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(ComboBoxEfetuarVendaItensCarrinho, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel3))
                .addGroup(PanelVendaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(PanelVendaLayout.createSequentialGroup()
                        .addGap(21, 21, 21)
                        .addComponent(TextFieldVendaClienteCPF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(TextFieldVendaFuncionarioCPF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(PanelVendaLayout.createSequentialGroup()
                        .addGap(32, 32, 32)
                        .addComponent(jLabel2)
                        .addGap(18, 18, 18)
                        .addComponent(jLabel4)))
                .addGroup(PanelVendaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(PanelVendaLayout.createSequentialGroup()
                        .addGap(9, 9, 9)
                        .addComponent(jLabel7)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel6))
                    .addGroup(PanelVendaLayout.createSequentialGroup()
                        .addGap(5, 5, 5)
                        .addComponent(TextFieldDataDeVenda, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(TextFieldDataDeGarantia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(7, 7, 7)
                .addComponent(ButtonEfetuarVenda, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        jTabbedPane1.addTab("Efetuar Venda", PanelVenda);

        PanelCadastros.addTab("Casos de Uso", jTabbedPane1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(PanelCadastros, javax.swing.GroupLayout.PREFERRED_SIZE, 567, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(TituloPrograma, javax.swing.GroupLayout.PREFERRED_SIZE, 307, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(124, 124, 124))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGap(20, 20, 20)
                .addComponent(TituloPrograma, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(PanelCadastros, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents
        
    private void ButtonEfetuarVendaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ButtonEfetuarVendaActionPerformed
        //realizar o carregamento do JDBC 

        try{
            Class.forName("org.postgresql.Driver");
            //Construindo a conexao com SGBD PostgreSQL
//            Connection conexao = DriverManager.getConnection("jdbc:postgresql://localhost:5432/postgres", "postgres", "12345");
//            JOptionPane.showMessageDialog (null, "CONEXÃO REALIZADA!");
            Connection con;
            con = DriverManager.getConnection("jdbc:postgresql://localhost:5432/postgres", "postgres", passcode);
            JOptionPane.showMessageDialog (null, "CONEXÃO REALIZADA!");
            
            String query = "INSERT INTO Venda VALUES(?,?,?,?,?)"; 
//CREATE TABLE Venda (
//  idVenda SERIAL  NOT NULL ,
//  Cliente_CPF INTEGER   NOT NULL ,
//  Vendedor_Funcionario_CPF INTEGER   NOT NULL ,
//  dataDeCompra DATE    ,
//  dataDeGarantia DATE      ,
//PRIMARY KEY(idVenda));            
            String query1 = "INSERT INTO troca VALUES(?,?,?,?,?)"; 
//CREATE TABLE Troca (
//  idTroca SERIAL  NOT NULL ,
//  ProdutoVendido_Produto_idProduto INTEGER   NOT NULL ,
//  Produto_idProduto INTEGER   NOT NULL ,
//  Vendedor_Funcionario_CPF INTEGER   NOT NULL ,
//  Cliente_CPF INTEGER   NOT NULL   ,
//PRIMARY KEY(idTroca));            
            String query2 = "INSERT INTO TransacaoVenda VALUES(?,?)"; 
//CREATE TABLE TransacaoVenda (
//  Produto_idProduto INTEGER   NOT NULL ,
//  Venda_idVenda INTEGER   NOT NULL );
            String query3 = "INSERT INTO ProdutoVendido VALUES(?)";    
//CREATE TABLE ProdutoVendido (
//  Produto_idProduto INTEGER   NOT NULL   ,
//PRIMARY KEY(Produto_idProduto));
            
            PreparedStatement stmt = con.prepareStatement(query); 
            PreparedStatement stmt1 = con.prepareStatement(query1); 
            PreparedStatement stmt2 = con.prepareStatement(query2); 
            PreparedStatement stmt3 = con.prepareStatement(query3); 
            
            stmt.setInt(1, Integer.parseInt(TextFieldVendaID.getText())); 
            stmt.setInt(2, Integer.parseInt(TextFieldVendaClienteCPF.getText()));
            stmt.setInt(3, Integer.parseInt(TextFieldVendaFuncionarioCPF.getText()));
            stmt.setDate(4, java.sql.Date.valueOf(new Data().formataDataRetornaBD(TextFieldDataDeVenda.getText())));  
            stmt.setDate(5, java.sql.Date.valueOf(new Data().formataDataRetornaBD(TextFieldDataDeGarantia.getText()))); 
            
            stmt1.setInt(1, Integer.parseInt(TextFieldVendaID.getText())); 
            stmt1.setInt(2, Integer.parseInt(TextFieldVendaCodigoDoProduto.getText()));
            stmt1.setInt(3, Integer.parseInt(TextFieldVendaCodigoDoProduto.getText()));
            stmt1.setInt(4, Integer.parseInt(TextFieldVendaFuncionarioCPF.getText()));
            stmt1.setInt(5, Integer.parseInt(TextFieldVendaClienteCPF.getText()));
            
            stmt2.setInt(2, Integer.parseInt(TextFieldVendaCodigoDoProduto.getText()));
            stmt2.setInt(1, Integer.parseInt(TextFieldVendaID.getText())); 
            
            stmt3.setInt(1, Integer.parseInt(TextFieldVendaCodigoDoProduto.getText()));
            
            stmt.executeUpdate(); 
            stmt1.executeUpdate();
            stmt2.executeUpdate();
            stmt3.executeUpdate();
            
            stmt.close();
            stmt1.close(); 
            stmt2.close(); 
            stmt3.close(); 
            
            con.close(); 
            JOptionPane.showMessageDialog (null, "REGISTRO GRAVADO!");
            
        }catch(ClassNotFoundException e){
            JOptionPane.showMessageDialog(null, "ERRO CLASSE: " + e.getMessage());
        }catch(SQLException e){
            JOptionPane.showMessageDialog(null, "ERRO SQL: " + e.getMessage());
        } catch (ParseException ex) {
            Logger.getLogger(Prototipo.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_ButtonEfetuarVendaActionPerformed

    private void ButtonCadastrarProdutoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ButtonCadastrarProdutoActionPerformed
try{
            Class.forName("org.postgresql.Driver");

            Connection con;
            con = DriverManager.getConnection("jdbc:postgresql://localhost:5432/postgres", "postgres", passcode);
            
            JOptionPane.showMessageDialog (null, "CONEXÃO REALIZADA!");
            
            String query = "INSERT INTO produto VALUES(?,?,?,?,?)"; 
//CREATE TABLE Produto (
//  idProduto INTEGER   NOT NULL ,
//  marca TEXT    ,
//  modelo TEXT    ,
//  preco DECIMAL    ,
//  numeroDeSerie INTEGER      ,
//PRIMARY KEY(idProduto));
            PreparedStatement stmt = con.prepareStatement(query); 
            
            stmt.setInt(1, Integer.parseInt(TextFieldProdutoCodigo.getText())); 
            stmt.setString(2, TextFieldProdutoMarca.getText());
            stmt.setString(3, TextFieldProdutoModelo.getText());
            stmt.setInt(4, Integer.parseInt(TextFieldProdutoPreco.getText()));
            stmt.setInt(5, Integer.parseInt(TextFieldProdutoNumSerie.getText()));

            stmt.executeUpdate(); 
            stmt.close(); 

            con.close(); 
            
            JOptionPane.showMessageDialog (null, "REGISTRO GRAVADO!");
            
   
        
        }catch(ClassNotFoundException e){
            JOptionPane.showMessageDialog(null, "ERRO CLASSE: " + e.getMessage());
        }catch(SQLException e){
            JOptionPane.showMessageDialog(null, "ERRO SQL: " + e.getMessage());
        }
        

        
        
        // TODO add your handling code here:
    }//GEN-LAST:event_ButtonCadastrarProdutoActionPerformed

    private void ButtonCadastrarFuncionarioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ButtonCadastrarFuncionarioActionPerformed

        try{
            Class.forName("org.postgresql.Driver");
            //Construindo a conexao com SGBD PostgreSQL
//            Connection conexao = DriverManager.getConnection("jdbc:postgresql://localhost:5432/postgres", "postgres", "12345");
//            JOptionPane.showMessageDialog (null, "CONEXÃO REALIZADA!");
            Connection con;
            con = DriverManager.getConnection("jdbc:postgresql://localhost:5432/postgres", "postgres", passcode);
            
            JOptionPane.showMessageDialog (null, "CONEXÃO REALIZADA!");
            
            String query = "INSERT INTO funcionario VALUES(?,?,?,?,?,?)"; 
            PreparedStatement stmt = con.prepareStatement(query); 
            String query1 = "INSERT INTO endereco_funcionario VALUES(?,?,?,?,?,?,?)"; 
            PreparedStatement stmt1 = con.prepareStatement(query1); 
            
            stmt.setInt(1, Integer.parseInt(TextFieldFuncionarioCPF.getText())); 
            stmt.setString(2, TextFieldFuncionarioNome.getText());
            stmt.setDate(3, java.sql.Date.valueOf(new Data().formataDataRetornaBD(TextFieldFuncionarioDataDeNasc.getText())));  
            stmt.setInt(4, Integer.parseInt(TextFieldFuncionarioSalario.getText()));
            stmt.setString(5, TextFieldFuncionarioEmail.getText());
            stmt.setInt(6, Integer.parseInt(TextFieldFuncionarioTelefone.getText()));
        
            stmt1.setInt(1, Integer.parseInt(TextFieldFuncionarioCPF.getText()));
            stmt1.setInt(2, Integer.parseInt(TextFieldFuncionarioLogradouro.getText()));
            stmt1.setInt(3, Integer.parseInt(TextFieldFuncionarioNumero.getText()));
            stmt1.setInt(4, Integer.parseInt(TextFieldFuncionarioCEP.getText()));
            stmt1.setString(5, TextFieldFuncionarioEstado.getText());
            stmt1.setString(6, TextFieldFuncionarioCidade.getText());
            stmt1.setString(7, TextFieldFuncionarioComplemento.getText());
            stmt1.executeUpdate(); 
            
            stmt.executeUpdate(); 
            stmt.close(); 
            stmt1.close(); 
            con.close(); 
            
            JOptionPane.showMessageDialog (null, "REGISTRO GRAVADO!");
            
            
                       
        /*    String campoEnd = this.TextFieldFuncionarioEndereco.getText();
            Endereco ender = new Endereco();
            ender.SetEnderecoCompleto(campoEnd);
               
            
        
        if (this.TextFieldFuncionarioCargo.getText().equalsIgnoreCase("gerente")){
                  int CPF_gerente = Integer.parseInt(this.TextFieldFuncionarioCPF.getText());
                  
                  int CPF = Integer.parseInt(this.TextFieldFuncionarioCPF.getText());
                  String nome = this.TextFieldFuncionarioNome.getText(); 
                  Data dataNascimento = this.TextFieldFuncionarioNasc.getText(); 
                  Endereco enderec = ender; 
                  double salario = Double.valueOf(this.TextFieldFuncionarioSalario.getText());
                  String email = this.TextFieldFuncionarioEmail.getText();
                  String telefone = this.TextFieldFuncionarioTelefone.getText();
             Gerente manager = new Gerente (CPF, inicioGerencia, CPF,  nome, dataNascimento, enderec, salario, email, telefone);
            
        }else{
            int CPF_gerente = Integer.parseInt(this.TextFieldFuncionarioCPF.getText());
                  
                  int CPF = Integer.parseInt(this.TextFieldFuncionarioCPF.getText());
                  String nome = this.TextFieldFuncionarioNome.getText(); 
                  Data dataNascimento = this.TextFieldFuncionarioNasc.getText(); 
                  Endereco enderec = ender; 
                  double salario = Double.valueOf(this.TextFieldFuncionarioSalario.getText());
                  String email = this.TextFieldFuncionarioEmail.getText();
                  String telefone = this.TextFieldFuncionarioTelefone.getText();
            Vendedor vend = new Vendedor(CPF_gerente, "01/01/2013" , CPF, nome, dataNascimento, ender, salario, email, telefone);
            
        }*/
        /*
        //JOptionPane.showMessageDialog (null, "CONEXÃO REALIZADA!");
            String query = "INSERT INTO Funcionario VALUES(,?,?,?,?,?,?)"; 
            stmt.setInt(1, Integer.parseInt(jTextField1.getText())); 
            stmt.setInt(2, Integer.parseInt(jTextField2.getText()));

            stmt.setDate(3, java.sql.Date.valueOf(new Vendas().formataDataRetornaBD(jTextField3.getText())));  
            stmt.setInt(4, Integer.parseInt(jTextField4.getText())); 
            stmt.setInt(5, Integer.parseInt(jTextField5.getText())); 
            stmt.setDate(6, java.sql.Date.valueOf(new Vendas().formataDataRetornaBD(jTextField6.getText()))); 
            
            stmt.setInt(7, Integer.parseInt(jTextField7.getText()));
            
            stmt.executeUpdate(); 
            
            stmt.close(); 
            con.close(); 
            JOptionPane.showMessageDialog (null, "REGISTRO GRAVADO!");
            
            PreparedStatement stmt = con.prepareStatement(query);
        
        */
        
        
        
        }catch(ClassNotFoundException e){
            JOptionPane.showMessageDialog(null, "ERRO CLASSE: " + e.getMessage());
        }catch(SQLException e){
            JOptionPane.showMessageDialog(null, "ERRO SQL: " + e.getMessage());
        } catch (ParseException ex) {
            Logger.getLogger(Prototipo.class.getName()).log(Level.SEVERE, null, ex);
        } 
        
        
        
        // TODO add your handling code here:
    }//GEN-LAST:event_ButtonCadastrarFuncionarioActionPerformed

    private void TextFieldFuncionarioLogradouroActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_TextFieldFuncionarioLogradouroActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_TextFieldFuncionarioLogradouroActionPerformed

    private void ButtonCadastrarClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ButtonCadastrarClienteActionPerformed
       try{
            Class.forName("org.postgresql.Driver");

            Connection con;
            con = DriverManager.getConnection("jdbc:postgresql://localhost:5432/postgres", "postgres", passcode);
            
            JOptionPane.showMessageDialog (null, "CONEXÃO REALIZADA!");
            
            String query = "INSERT INTO cliente VALUES(?,?,?,?,?,?)"; 
            PreparedStatement stmt = con.prepareStatement(query); 
            String query1 = "INSERT INTO endereco_cliente VALUES(?,?,?,?,?,?,?)"; 
            PreparedStatement stmt1 = con.prepareStatement(query1); 
            
            stmt.setInt(1, Integer.parseInt(TextFieldClienteCPF.getText())); 
            stmt.setString(2, TextFieldClienteNome.getText());
            stmt.setDate(3, java.sql.Date.valueOf(new Data().formataDataRetornaBD(TextFieldClienteDataDeNasc.getText())));  
            stmt.setString(4, TextFieldClienteEmail.getText());
            stmt.setInt(5, Integer.parseInt(TextFieldClienteTelefone.getText()));
            stmt.setInt(6, Integer.parseInt(TextFieldClienteRenda.getText()));
            
            stmt1.setInt(1, Integer.parseInt(TextFieldClienteCPF.getText()));
            stmt1.setInt(2, Integer.parseInt(TextFieldClienteLogradouro.getText()));
            stmt1.setInt(3, Integer.parseInt(TextFieldClienteNumero.getText()));
            stmt1.setInt(4, Integer.parseInt(TextFieldClienteCEP.getText()));
            stmt1.setString(5, TextFieldClienteEstado.getText());
            stmt1.setString(6, TextFieldClienteCidade.getText());
            stmt1.setString(7, TextFieldClienteComplemento.getText());
            stmt1.executeUpdate(); 
            
            stmt.executeUpdate(); 
            stmt.close(); 
            stmt1.close(); 
            con.close(); 
            
            JOptionPane.showMessageDialog (null, "REGISTRO GRAVADO!");
            
        
        
        }catch(ClassNotFoundException e){
            JOptionPane.showMessageDialog(null, "ERRO CLASSE: " + e.getMessage());
        }catch(SQLException e){
            JOptionPane.showMessageDialog(null, "ERRO SQL: " + e.getMessage());
        } catch (ParseException ex) {
            Logger.getLogger(Prototipo.class.getName()).log(Level.SEVERE, null, ex);
        } 
    }//GEN-LAST:event_ButtonCadastrarClienteActionPerformed

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
      try{
            Class.forName("org.postgresql.Driver");

            Connection con;
            con = DriverManager.getConnection("jdbc:postgresql://localhost:5432/postgres", "postgres", passcode);
            
            JOptionPane.showMessageDialog (null, "CONEXÃO REALIZADA!");
            
            String query = "UPDATE troca SET Produto_idProduto=? WHERE ProdutoVendido_Produto_idProduto=?"; 
                         
//CREATE TABLE Troca (
//  idTroca SERIAL  NOT NULL ,
//  ProdutoVendido_Produto_idProduto INTEGER   NOT NULL ,
//  Produto_idProduto INTEGER   NOT NULL ,
//  Vendedor_Funcionario_CPF INTEGER   NOT NULL ,
//  Cliente_CPF INTEGER   NOT NULL   ,
//PRIMARY KEY(idTroca));
            
            PreparedStatement stmt = con.prepareStatement(query); 

            
            stmt.setInt(1, Integer.parseInt(TextFieldCodigoNovoProduto.getText())); 
            stmt.setInt(2, Integer.parseInt(TextFieldCodigoDefeituoso.getText())); 
            
            
            
            stmt.executeUpdate(); 
            stmt.close(); 

            con.close(); 
            
            JOptionPane.showMessageDialog (null, "REGISTRO GRAVADO E TROCA REALIZADA!");
            
        
        
        }catch(ClassNotFoundException e){
            JOptionPane.showMessageDialog(null, "ERRO CLASSE: " + e.getMessage());
        }catch(SQLException e){
            JOptionPane.showMessageDialog(null, "ERRO SQL: " + e.getMessage());
        }
    }//GEN-LAST:event_jButton2ActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(Prototipo.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(Prototipo.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(Prototipo.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(Prototipo.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Prototipo().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton ButtonCadastrarCliente;
    private javax.swing.JButton ButtonCadastrarFuncionario;
    private javax.swing.JButton ButtonCadastrarProduto;
    private javax.swing.JButton ButtonEfetuarVenda;
    private javax.swing.JComboBox ComboBoxEfetuarVendaItensCarrinho;
    private javax.swing.JPanel PanelCadastroCliente;
    private javax.swing.JPanel PanelCadastroFuncionario;
    private javax.swing.JTabbedPane PanelCadastros;
    private javax.swing.JPanel PanelTroca;
    private javax.swing.JPanel PanelVenda;
    private javax.swing.JTextField TextFieldClienteCEP;
    private javax.swing.JTextField TextFieldClienteCPF;
    private javax.swing.JTextField TextFieldClienteCidade;
    private javax.swing.JTextField TextFieldClienteComplemento;
    private javax.swing.JTextField TextFieldClienteDataDeNasc;
    private javax.swing.JTextField TextFieldClienteEmail;
    private javax.swing.JTextField TextFieldClienteEndereco;
    private javax.swing.JTextField TextFieldClienteEstado;
    private javax.swing.JTextField TextFieldClienteLogradouro;
    private javax.swing.JTextField TextFieldClienteNome;
    private javax.swing.JTextField TextFieldClienteNumero;
    private javax.swing.JTextField TextFieldClienteRenda;
    private javax.swing.JTextField TextFieldClienteTelefone;
    private javax.swing.JTextField TextFieldCodigoDefeituoso;
    private javax.swing.JTextField TextFieldCodigoNovoProduto;
    private javax.swing.JTextField TextFieldDataDeGarantia;
    private javax.swing.JTextField TextFieldDataDeVenda;
    private javax.swing.JTextField TextFieldFuncionarioCEP;
    private javax.swing.JTextField TextFieldFuncionarioCPF;
    private javax.swing.JTextField TextFieldFuncionarioCidade;
    private javax.swing.JTextField TextFieldFuncionarioComplemento;
    private javax.swing.JTextField TextFieldFuncionarioDataDeNasc;
    private javax.swing.JTextField TextFieldFuncionarioEmail;
    private javax.swing.JTextField TextFieldFuncionarioEstado;
    private javax.swing.JTextField TextFieldFuncionarioLogradouro;
    private javax.swing.JTextField TextFieldFuncionarioNome;
    private javax.swing.JTextField TextFieldFuncionarioNumero;
    private javax.swing.JTextField TextFieldFuncionarioSalario;
    private javax.swing.JTextField TextFieldFuncionarioTelefone;
    private javax.swing.JTextField TextFieldProdutoCodigo;
    private javax.swing.JPanel TextFieldProdutoID;
    private javax.swing.JTextField TextFieldProdutoMarca;
    private javax.swing.JTextField TextFieldProdutoModelo;
    private javax.swing.JTextField TextFieldProdutoNumSerie;
    private javax.swing.JTextField TextFieldProdutoPreco;
    private javax.swing.JTextField TextFieldVendaClienteCPF;
    private javax.swing.JTextField TextFieldVendaCodigoDoProduto;
    private javax.swing.JTextField TextFieldVendaFuncionarioCPF;
    private javax.swing.JTextField TextFieldVendaID;
    private javax.swing.JLabel TituloPrograma;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel26;
    private javax.swing.JLabel jLabel27;
    private javax.swing.JLabel jLabel28;
    private javax.swing.JLabel jLabel29;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel30;
    private javax.swing.JLabel jLabel31;
    private javax.swing.JLabel jLabel32;
    private javax.swing.JLabel jLabel33;
    private javax.swing.JLabel jLabel34;
    private javax.swing.JLabel jLabel35;
    private javax.swing.JLabel jLabel36;
    private javax.swing.JLabel jLabel37;
    private javax.swing.JLabel jLabel38;
    private javax.swing.JLabel jLabel39;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel40;
    private javax.swing.JLabel jLabel41;
    private javax.swing.JLabel jLabel42;
    private javax.swing.JLabel jLabel43;
    private javax.swing.JLabel jLabel44;
    private javax.swing.JLabel jLabel45;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JTabbedPane jTabbedPane1;
    // End of variables declaration//GEN-END:variables
}
